Micron Document
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| SparkN0de-git | SparkN0de |
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


Commit 7416c9c6635168322bcb93efe3b9e8dd967e030f


Parents : c9511f7
Author : Mark Qvist <mark@unsigned.io>
Date : 2022-01-24T20:33:58+01:00

Add support for LoRa32 v2.0

Changes

3 files changed, 44 insertions(+), 11 deletions(-)

M Config.h +4 -4
M Makefile +1 -1
M Utilities.h +39 -6

Diff

diff --git a/Config.h b/Config.h
index 72cc480..21649b9 100644
--- a/Config.h
+++ b/Config.h
@@ -103,11 +103,11 @@
const int pin_reset = 12;
const int pin_dio = 26;
#if defined(EXTERNAL_LEDS)
- const int pin_led_rx = 15;
- const int pin_led_tx = 4;
+ const int pin_led_rx = 2;
+ const int pin_led_tx = 0;
#else
- const int pin_led_rx = 23;
- const int pin_led_tx = 23;
+ const int pin_led_rx = 22;
+ const int pin_led_tx = 22;
#endif
#elif BOARD_MODEL == BOARD_LORA32_V2_1
const int pin_cs = 18;

diff --git a/Makefile b/Makefile
index a874d62..25ccacc 100644
--- a/Makefile
+++ b/Makefile
@@ -48,7 +48,7 @@ upload-tbeam:
arduino-cli upload -p /dev/ttyUSB0 --fqbn esp32:esp32:t-beam
upload-lora32_v20:
- arduino-cli upload -p /dev/ttyACM0 --fqbn esp32:esp32:ttgo-lora32
+ arduino-cli upload -p /dev/ttyUSB0 --fqbn esp32:esp32:ttgo-lora32
upload-lora32_v21:
arduino-cli upload -p /dev/ttyACM0 --fqbn esp32:esp32:ttgo-lora32

diff --git a/Utilities.h b/Utilities.h
index 5a8a7b1..5b59364 100644
--- a/Utilities.h
+++ b/Utilities.h
@@ -42,10 +42,17 @@ uint8_t boot_vector = 0x00;
void led_tx_on() { digitalWrite(pin_led_tx, LOW); }
void led_tx_off() { digitalWrite(pin_led_tx, HIGH); }
#elif BOARD_MODEL == BOARD_LORA32_V2_0
- void led_rx_on() { digitalWrite(pin_led_rx, HIGH); }
- void led_rx_off() { digitalWrite(pin_led_rx, LOW); }
- void led_tx_on() { digitalWrite(pin_led_tx, HIGH); }
- void led_tx_off() { digitalWrite(pin_led_tx, LOW); }
+ #if defined(EXTERNAL_LEDS)
+ void led_rx_on() { digitalWrite(pin_led_rx, HIGH); }
+ void led_rx_off() { digitalWrite(pin_led_rx, LOW); }
+ void led_tx_on() { digitalWrite(pin_led_tx, HIGH); }
+ void led_tx_off() { digitalWrite(pin_led_tx, LOW); }
+ #else
+ void led_rx_on() { digitalWrite(pin_led_rx, LOW); }
+ void led_rx_off() { digitalWrite(pin_led_rx, HIGH); }
+ void led_tx_on() { digitalWrite(pin_led_tx, LOW); }
+ void led_tx_off() { digitalWrite(pin_led_tx, HIGH); }
+ #endif
#elif BOARD_MODEL == BOARD_LORA32_V2_1
void led_rx_on() { digitalWrite(pin_led_rx, HIGH); }
void led_rx_off() { digitalWrite(pin_led_rx, LOW); }
@@ -143,6 +150,19 @@ void led_indicate_warning(int cycles) {
}
led_rx_off();
}
+ #elif BOARD_MODEL == BOARD_LORA32_V2_0
+ void led_indicate_info(int cycles) {
+ bool forever = (cycles == 0) ? true : false;
+ cycles = forever ? 1 : cycles;
+ while(cycles > 0) {
+ led_rx_off();
+ delay(100);
+ led_rx_on();
+ delay(100);
+ if (!forever) cycles--;
+ }
+ led_rx_off();
+ }
#else
void led_indicate_info(int cycles) {
bool forever = (cycles == 0) ? true : false;
@@ -214,10 +234,13 @@ int8_t led_standby_direction = 0;
#if defined(EXTERNAL_LEDS)
led_rx_off();
#endif
+ #elif BOARD_MODEL == BOARD_LORA32_V2_0
+ #if defined(EXTERNAL_LEDS)
+ led_rx_off();
+ #endif
#else
led_rx_off();
#endif
-
}
}
#endif
@@ -253,7 +276,17 @@ int8_t led_standby_direction = 0;
} else {
led_tx_off();
}
- led_rx_off();
+ #if BOARD_MODEL == BOARD_LORA32_V2_1
+ #if defined(EXTERNAL_LEDS)
+ led_rx_off();
+ #endif
+ #elif BOARD_MODEL == BOARD_LORA32_V2_0
+ #if defined(EXTERNAL_LEDS)
+ led_rx_off();
+ #endif
+ #else
+ led_rx_off();
+ #endif
}
}
#endif


──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────